#MP Moralization and Foreign Policy Attitudes Replication File: Study 1 analyses 
####Last updated: 3 June 2025

###Analyses carried out using R version 4.4.3 in RStudio version Version XXX on Lenovo ThinkPad X1 Carbon Gen 12 Intel Core Ultra 7 155U, 1700 Mhz, 12 running Windows 11 Enterprize

#### This file replicates results in the manuscript. Run "MP_study1_0.R" first for variable coding, functions, and packages!

#sample size
nrow(data) #2132

#Good completes 
table(data$good_complete, useNA="ifany") #1948



# Foreign Policy Orientation alphas ---------------------------------------

#Militant Internationalism
mi.df <- data.frame(data$mil1, data$mil2, data$mil3)
mi.alpha <- psych::alpha(mi.df, max=12) 
round(mi.alpha$total[1], digits=2) #alpha=0.7

#Cooperative Internationalism
ci.df <- data.frame(data$cint1, data$cint2, data$cint3)
ci.alpha <- psych::alpha(ci.df, max=12) 
round(ci.alpha$total[1], digits=2) #alpha=0.79

#Isolationism
iso.df <- data.frame(data$iso1, data$iso2, data$iso3)
iso.alpha <- psych::alpha(iso.df, max=12) 
round(iso.alpha$total[1], digits=2) #alpha=0.81

#Factor analysis: "A principal axis factor analysis confirmed that the scale components correlate with distinct latent factors."
dat.orientations <- cbind(mi.df, ci.df, iso.df)

orientations.pa <- fa.parallel(dat.orientations, fa="both") # 3 factors, 3 components
orientations.pa 

orientations.fit <- fa(dat.orientations, nfactors=3, rotate="oblimin",scores=TRUE, fm="pa")
orientations.fit$loadings 
orientations.fit 



# ### Footnote 12: Effect of treatments on "neither support nor oppose" ---------------------------------------------------------

#First, relevel so that control is the reference group for each indidivual treatment:
data$treat_hr1 <- relevel(as.factor(data$treat_hr1), ref="control")
data$treat_hr2 <- relevel(as.factor(data$treat_hr2), ref="control")

data$treat_climate1 <- relevel(as.factor(data$treat_climate1), ref="control")
data$treat_climate2 <- relevel(as.factor(data$treat_climate2), ref="control")

data$treat_aid1 <- relevel(as.factor(data$treat_aid1), ref="control")
data$treat_aid2 <- relevel(as.factor(data$treat_aid2), ref="control")

data$treat_security1 <- relevel(as.factor(data$treat_security1), ref="control")
data$treat_security2 <- relevel(as.factor(data$treat_security2), ref="control")

data$treat_cooperation1 <- relevel(as.factor(data$treat_cooperation1), ref="control")
data$treat_cooperation2 <- relevel(as.factor(data$treat_cooperation2), ref="control")

data$treat_economic1 <- relevel(as.factor(data$treat_economic1), ref="control")
data$treat_economic2 <- relevel(as.factor(data$treat_economic2), ref="control")


#Estimate effect of treatments on respondents choosing "neither support nor oppose" to explore implications of plausibility considerations:

mod.hr1mid <- lm(hr1mid ~ treat_hr1, data=data)
mod.hr2mid <- lm(hr2mid ~ treat_hr2, data=data)

mod.climate1mid <- lm(climate1mid ~ treat_climate1, data=data)
mod.climate2mid <- lm(climate2mid ~ treat_climate2, data=data)

mod.aid1mid <- lm(aid1mid ~ treat_aid1, data=data)
mod.aid2mid <- lm(aid2mid ~ treat_aid2, data=data)

mod.security1mid <- lm(security1mid ~ treat_security1, data=data)
mod.security2mid <- lm(security2mid ~ treat_security2, data=data)

mod.coop1mid <- lm(cooperation1mid ~ treat_cooperation1, data=data)
mod.coop2mid <- lm(cooperation2mid ~ treat_cooperation2, data=data)

mod.economic1mid <- lm(economic1mid ~ treat_economic1, data=data)
mod.economic2mid <- lm(economic2mid ~ treat_economic2, data=data)

#Adversary treatment: Positive effect (p<0.05) for choosing midpoint on vaccine aid; no other positive effects p<0.05
rbind(cbind(round(mod.hr1mid$coefficients[2], digits=2), round(summary(mod.hr1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.hr2mid$coefficients[2], digits=2), round(summary(mod.hr2mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.climate1mid$coefficients[2], digits=2), round(summary(mod.climate1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.climate2mid$coefficients[2], digits=2), round(summary(mod.climate2mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.aid1mid$coefficients[2], digits=2), round(summary(mod.aid1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.aid2mid$coefficients[2], digits=2), round(summary(mod.aid2mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.security1mid$coefficients[2], digits=2), round(summary(mod.security1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.security2mid$coefficients[2], digits=2), round(summary(mod.security2mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.coop1mid$coefficients[2], digits=2), round(summary(mod.coop1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.coop2mid$coefficients[2], digits=2), round(summary(mod.coop2mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.economic1mid$coefficients[2], digits=2), round(summary(mod.economic1mid)$coefficients[2, 4], digits=3)),
      cbind(round(mod.economic2mid$coefficients[2], digits=2), round(summary(mod.economic2mid)$coefficients[2, 4], digits=3)))

#Partner treatment: Positive effect (p<0.05) for choosing midpoint on vaccine aid; p=0.058 for effect of partner on midpoint for FDI restrictions
rbind(cbind(round(mod.hr1mid$coefficients[3], digits=2), round(summary(mod.hr1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.hr2mid$coefficients[3], digits=2), round(summary(mod.hr2mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.climate1mid$coefficients[3], digits=2), round(summary(mod.climate1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.climate2mid$coefficients[3], digits=2), round(summary(mod.climate2mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.aid1mid$coefficients[3], digits=2), round(summary(mod.aid1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.aid2mid$coefficients[3], digits=2), round(summary(mod.aid2mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.security1mid$coefficients[3], digits=2), round(summary(mod.security1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.security2mid$coefficients[3], digits=2), round(summary(mod.security2mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.coop1mid$coefficients[3], digits=2), round(summary(mod.coop1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.coop2mid$coefficients[3], digits=2), round(summary(mod.coop2mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.economic1mid$coefficients[3], digits=2), round(summary(mod.economic1mid)$coefficients[3, 4], digits=3)),
      cbind(round(mod.economic2mid$coefficients[3], digits=2), round(summary(mod.economic2mid)$coefficients[3, 4], digits=3)))



# ### Figure 1 ------------------------------------------------------------

#Generate summary data for each policy

#Human rights
hrmoral.sum <- summarySE(dat.hrsum, measurevar="dv_moral", groupvars="hisalience")
hrmoral.sumavg <- summarySE(dat.hrsum, measurevar="dv_moral",  groupvars="issuearea") 

#Cliamte
climatemoral.sum <- summarySE(dat.climatesum, measurevar="dv_moral", groupvars="hisalience")
climatemoral.sumavg <- summarySE(dat.climatesum, measurevar="dv_moral", groupvars="issuearea")

#Aid
aidmoral.sum <- summarySE(dat.aidsum, measurevar="dv_moral", groupvars="hisalience")
aidmoral.sumavg <- summarySE(dat.aidsum, measurevar="dv_moral", groupvars="issuearea")

#Security
secmoral.sum <- summarySE(dat.secsum, measurevar="dv_moral", groupvars="hisalience")
secmoral.sumavg <- summarySE(dat.secsum, measurevar="dv_moral", groupvars="issuearea")

#Cooperation
coopmoral.sum <- summarySE(dat.coopsum, measurevar="dv_moral", groupvars="hisalience")
coopmoral.sumavg <- summarySE(dat.coopsum, measurevar="dv_moral", groupvars="issuearea")

#Economics
econmoral.sum <- summarySE(dat.econsum, measurevar="dv_moral", groupvars="hisalience")
econmoral.sumavg <- summarySE(dat.econsum, measurevar="dv_moral", groupvars="issuearea")

#Combine into a data frame: 
moralmeans.mat <- data.frame(rbind(cbind(hrmoral.sum[1,3], (hrmoral.sum[1,3]-hrmoral.sum[1,6]), (hrmoral.sum[1,3]+hrmoral.sum[1,6])),
                                   cbind(hrmoral.sum[2,3], (hrmoral.sum[2,3]-hrmoral.sum[2,6]), (hrmoral.sum[2,3]+hrmoral.sum[1,6])),
                                   cbind(hrmoral.sumavg[1,3], (hrmoral.sumavg[1,3]-hrmoral.sumavg[1,6]), (hrmoral.sumavg[1,3]+hrmoral.sumavg[1,6])),
                                   cbind(climatemoral.sum[1,3], (climatemoral.sum[1,3]-climatemoral.sum[1,6]), (climatemoral.sum[1,3]+climatemoral.sum[1,6])),
                                   cbind(climatemoral.sum[2,3], (climatemoral.sum[2,3]-climatemoral.sum[2,6]), (climatemoral.sum[2,3]+climatemoral.sum[2,6])),
                                   cbind(climatemoral.sumavg[1,3], (climatemoral.sumavg[1,3]-climatemoral.sumavg[1,6]), (climatemoral.sumavg[1,3]+climatemoral.sum[2,6])),
                                   cbind(aidmoral.sum[1,3], (aidmoral.sum[1,3]-aidmoral.sum[1,6]), (aidmoral.sum[1,3]+aidmoral.sum[1,6])),
                                   cbind(aidmoral.sum[2,3], (aidmoral.sum[2,3]-aidmoral.sum[2,6]), (aidmoral.sum[2,3]+aidmoral.sum[2,6])),
                                   cbind(aidmoral.sumavg[1,3], (aidmoral.sumavg[1,3]-aidmoral.sumavg[1,6]), (aidmoral.sumavg[1,3]+aidmoral.sumavg[1,6])),
                                   cbind(secmoral.sum[1,3], (secmoral.sum[1,3]-secmoral.sum[1,6]), (secmoral.sum[1,3]+secmoral.sum[1,6])),
                                   cbind(secmoral.sum[2,3], (secmoral.sum[2,3]-secmoral.sum[2,6]), (secmoral.sum[2,3]+secmoral.sum[2,6])),
                                   cbind(secmoral.sumavg[1,3], (secmoral.sumavg[1,3]-secmoral.sumavg[1,6]), (secmoral.sumavg[1,3]+secmoral.sumavg[1,6])),
                                   cbind(coopmoral.sum[1,3], (coopmoral.sum[1,3]-coopmoral.sum[1,6]), (coopmoral.sum[1,3]+coopmoral.sum[1,6])),
                                   cbind(coopmoral.sum[2,3], (coopmoral.sum[2,3]-coopmoral.sum[2,6]), (coopmoral.sum[2,3]+coopmoral.sum[2,6])),
                                   cbind(coopmoral.sumavg[1,3], (coopmoral.sumavg[1,3]-coopmoral.sumavg[1,6]), (coopmoral.sumavg[1,3]+coopmoral.sumavg[1,6])),
                                   cbind(econmoral.sum[1,3], (econmoral.sum[1,3]-econmoral.sum[1,6]), (econmoral.sum[1,3]+econmoral.sum[1,6])),
                                   cbind(econmoral.sum[2,3], (econmoral.sum[2,3]-econmoral.sum[2,6]), (econmoral.sum[2,3]+econmoral.sum[2,6])),
                                   cbind(econmoral.sumavg[1,3], (econmoral.sumavg[1,3]-econmoral.sumavg[1,6]), (econmoral.sumavg[1,3]+econmoral.sumavg[1,6]))))
moralmeans.mat <- cbind(moralmeans.mat, salience=rep(c("Low Salience", "Higher Salience", "Issue Average"), times=3), issue=rep(c("Human Rights", "Climate", "Foreign Aid", "Security", "Cooperation", "Economics"), each=3),
                        policy=c( "Decent Work", "Defend Rights", "Human Rights Average", "Biodiversity", "Fossil Fuels", "Climate Average", 
                                  "Digital Inclusion","Vaccine Programs",  "Aid Average", "Nuclear Sabotage", "Counter-terrorism", "Security Average",
                                  "ICJ",  "United Nations", "Institutions Average", "Foreign Direct Investment", "Tariffs", "Economics Average"))

colnames(moralmeans.mat) <- c("Y", "Low_95", "Hi_95", "Salience", "Issue", "Policy")  
moralmeans.mat$Y <- as.numeric(as.character(moralmeans.mat$Y))
moralmeans.mat$Low_95 <- as.numeric(as.character(moralmeans.mat$Low_95))
moralmeans.mat$Hi_95 <- as.numeric(as.character(moralmeans.mat$Hi_95))


moralmeans.mat$Policy <- factor(moralmeans.mat$Policy , levels = c("Human Rights Average", "Defend Rights", "Decent Work", "Climate Average", "Fossil Fuels", "Biodiversity", 
                                                                   "Aid Average", "Vaccine Programs", "Digital Inclusion",  "Institutions Average", "United Nations", "ICJ",
                                                                   "Security Average", "Counter-terrorism", "Nuclear Sabotage", "Economics Average", "Tariffs", "Foreign Direct Investment"))


#Sample average across all issues
moralavg <- mean(data_long$dv_moral, na.rm=TRUE)

#Generate Figure 1
dev.new(height=7, width=12)
p.means.1 <- ggplot(moralmeans.mat, aes(x=Y, y=Policy)) +  
  geom_vline(xintercept = moralavg, colour="gray85", linewidth=1, linetype="dashed") + 
  geom_pointrangeh(data=moralmeans.mat, mapping=(aes(x=Y, y=Policy, xmin=Low_95, xmax=Hi_95, shape=factor(Salience), colour=factor(Issue))), 
                   position = position_dodge2v(height = 0.75), size=I(1.1)) + 
  scale_y_discrete(limits = rev(levels(moralmeans.mat$Policy))) + xlim(0.40, 0.70) +
  scale_linetype_manual(name="", guide="none") +
  scale_shape_discrete(name="", breaks=c("Issue Average", "Low Salience", "Higher Salience")) +
  scale_colour_manual(name="", guide="none", values=c("gray75", "gray60", "gray45", "gray30", "gray15", "gray0")) +
  ylab("") + xlab("Mean (95% Confidence Interval)") + ggtitle("") +
  coord_cartesian(clip="off") +
  theme_bw() + theme(axis.text.y=element_text(color="black", size=13, 
                                              face=c("plain", "plain", "bold.italic", "plain", "plain", "bold.italic", "plain", "plain", 
                                                     "bold.italic", "plain", "plain", "bold.italic", "plain", "plain", "bold.italic", "plain", "plain", "bold.italic")), 
                     axis.text.x=element_text(color="black"), 
                     axis.title.y=element_text(color="black", size=14),
                     axis.title.x=element_text(size=14), plot.title=element_text(color="black", size=14, hjust=0.5),
                     legend.text=element_text(size=14), 
                     legend.position="bottom", plot.margin = unit(c(.5,.5,.5,1), "cm"))
### Figure 1: Average Moral Conviction Scores by Policy
p.means.1

#Means discussed in text:
round(hrmoral.sumavg[,3], digits=2) #0.61 - human rights
round(econmoral.sumavg[,3], digits=2) #0.46 - economics
round(climatemoral.sumavg[,3], digits=2) #0.53 - climate
round(coopmoral.sumavg[,3], digits=2) #0.51 - cooperation
round(aidmoral.sumavg[,3], digits=2) #0.50 - aid
round(secmoral.sumavg[,3], digits=2) #0.52 - security


# Issue Area Moralization OLS  --------------------------------------------
obmod.pooled.1 <- lm(dv_moral ~ issuearea + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                       pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + mi1 + ci1 + isolat1 +
                       rel_attendr + rel_impr, data=data_long)
obmod.pooled.1.cl <- vcovCL(obmod.pooled.1, cluster=~ResponseId) #save the VCOV separately for estimating linear hypothesis tests
obmod.pooled.1r <- coeftest(obmod.pooled.1, vcov = obmod.pooled.1.cl) #cluster standard errors by respondent


#Coefficients and p-values cited in text:
hrvsec <- summary(glht(obmod.pooled.1, vcov=obmod.pooled.1.cl, linfct = "issueareahr-issueareasec=0"))
cbind(round(hrvsec$test$coefficients, digits=2), round(hrvsec$test$pvalues, digits=3)) #b=0.08, p<0.01

cbind((round(obmod.pooled.1r["issueareahr", "Estimate"], digits=2)), round(obmod.pooled.1r["issueareahr", "Pr(>|t|)"], digits=3)) #Human rights vs. economic b=0.14, p<0.01
cbind((round(obmod.pooled.1r["issueareaaid", "Estimate"], digits=2)), round(obmod.pooled.1r["issueareaaid", "Pr(>|t|)"], digits=3)) #Aid vs. economic b=0.04, p<0.01
cbind((round(obmod.pooled.1r["issueareaclimate", "Estimate"], digits=2)), round(obmod.pooled.1r["issueareaclimate", "Pr(>|t|)"], digits=3)) #Climate vs. economic b=0.07, p<0.01
cbind((round(obmod.pooled.1r["issueareacoop", "Estimate"], digits=2)), round(obmod.pooled.1r["issueareacoop", "Pr(>|t|)"], digits=3)) #Cooperation vs. economic b=0.05, p<0.01

#No evidence that people moralize climate, cooperation, or aid more than security; average moral conviction for security exceeds that for institutional cooperation and aid:
coopvsec <- summary(glht(obmod.pooled.1, vcov=obmod.pooled.1.cl, linfct = "issueareasec-issueareacoop=0"))
cbind(round(coopvsec$test$coefficients, digits=2), round(coopvsec$test$pvalues, digits=3)) #b=0.01, p<0.01

aidvsec <- summary(glht(obmod.pooled.1, vcov=obmod.pooled.1.cl, linfct = "issueareasec-issueareaaid=0"))
cbind(round(aidvsec$test$coefficients, digits=2), round(aidvsec$test$pvalues, digits=3)) #b=0.02, p<0.01

climatevsec <- summary(glht(obmod.pooled.1, vcov=obmod.pooled.1.cl, linfct = "issueareasec-issueareaclimate=0"))
cbind(round(climatevsec$test$coefficients, digits=2), round(climatevsec$test$pvalues, digits=3)) #b=-0.01, p=0.101


# ###Figure 2: Effect of Country treatments on moral conviction -------------------------------------------------------------

#Treatment effects, cluster standard errors by respondent:
mod.pooled.1 <- lm(dv_moral ~ treatment + issuearea, data=data_long)
mod.pooled.1r <- coeftest(mod.pooled.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.pooled.2 <- lm(dv_moral ~ treatment + issuearea + man + nhwhite + gensilent + genboom + genx + genmill +
                     pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=data_long)
mod.pooled.2r <- coeftest(mod.pooled.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent


####Separate models by issue area:
#Human Rights
mod.hr.1 <- lm(dv_moral ~ treatment, data=dat.hr)
mod.hr.1r <- coeftest(mod.hr.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.hr.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                 pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.hr)
mod.hr.2r <- coeftest(mod.hr.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent


#Climate:
mod.climate.1 <- lm(dv_moral ~ treatment, data=dat.climate)
mod.climate.1r <- coeftest(mod.climate.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.climate.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                      pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.climate)
mod.climate.2r <- coeftest(mod.climate.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent


#Aid:
mod.aid.1 <- lm(dv_moral ~ treatment, data=dat.aid)
mod.aid.1r <- coeftest(mod.aid.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.aid.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                  pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.aid)
mod.aid.2r <- coeftest(mod.aid.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Security:
mod.security.1 <- lm(dv_moral ~ treatment, data=dat.security)
mod.security.1r <- coeftest(mod.security.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.security.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                       pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.security)
mod.security.2r <- coeftest(mod.security.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Cooperation:
mod.coop.1 <- lm(dv_moral ~ treatment, data=dat.coop)
mod.coop.1r <- coeftest(mod.coop.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.coop.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                   pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.coop)
mod.coop.2r <- coeftest(mod.coop.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Economics:
mod.econ.1 <- lm(dv_moral ~ treatment, data=dat.econ)
mod.econ.1r <- coeftest(mod.econ.1, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent

#Add pre-registered covariates: gender, race, age cohorts, party, education, income, census region:
mod.econ.2 <- lm(dv_moral ~ treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                   pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf, data=dat.econ)
mod.econ.2r <- coeftest(mod.econ.2, vcov = vcovCL, cluster=~ResponseId) #cluster standard errors by respondent


#Results from pooled model show that the treatments had no overall effect on moral conviction:
rbind(cbind("Partner", round(mod.pooled.1r[2, "Estimate"], digits=2), round(mod.pooled.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.091
      cbind("Adversary", round(mod.pooled.1r[3, "Estimate"], digits=2), round(mod.pooled.1r[3, "Pr(>|t|)"], digits=3)),#b=-0.01, p=0.191
      cbind("Partner", round(mod.pooled.2r[2, "Estimate"], digits=2), round(mod.pooled.2r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.058
      cbind("Adversary", round(mod.pooled.2r[3, "Estimate"], digits=2), round(mod.pooled.2r[3, "Pr(>|t|)"], digits=3))) #b=-0.01, p=0.141
            

#Few exceptions in issue-specific models, and only one in the hypothesized direction:
rbind(cbind("Partner", round(mod.hr.1r[2, "Estimate"], digits=2), round(mod.hr.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.608
      cbind("Adversary", round(mod.hr.1r[3, "Estimate"], digits=2), round(mod.hr.1r[3, "Pr(>|t|)"], digits=3)),#b=-0.03, p<0.05; adversary decreases moral conviction about human rights
      cbind("Partner", round(mod.climate.1r[2, "Estimate"], digits=2), round(mod.climate.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.371
      cbind("Adversary", round(mod.climate.1r[3, "Estimate"], digits=2), round(mod.climate.1r[3, "Pr(>|t|)"], digits=3)), #b=-0.03, p<0.01; adversary decreases moral conviction about climate
      cbind("Partner", round(mod.aid.1r[2, "Estimate"], digits=2), round(mod.aid.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.65
      cbind("Adversary", round(mod.aid.1r[3, "Estimate"], digits=2), round(mod.aid.1r[3, "Pr(>|t|)"], digits=3)),#b=-0.01, p=0.242
      cbind("Partner", round(mod.security.1r[2, "Estimate"], digits=2), round(mod.security.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.4
      cbind("Adversary", round(mod.security.1r[3, "Estimate"], digits=2), round(mod.security.1r[3, "Pr(>|t|)"], digits=3)), #b=0, p=0.732
      cbind("Partner", round(mod.coop.1r[2, "Estimate"], digits=2), round(mod.coop.1r[2, "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.246
      cbind("Adversary", round(mod.coop.1r[3, "Estimate"], digits=2), round(mod.coop.1r[3, "Pr(>|t|)"], digits=3)),#b=0, p=0.868
      cbind("Partner", round(mod.econ.1r[2, "Estimate"], digits=2), round(mod.econ.1r[2, "Pr(>|t|)"], digits=3)), #b=-0, p=0.669
      cbind("Adversary", round(mod.econ.1r[3, "Estimate"], digits=2), round(mod.econ.1r[3, "Pr(>|t|)"], digits=3))) #b=0.04, p<0.01; adversary treatment increased moral conviction about economic issues



## Organize the data for Figure 2:
## Create a data frame with coefficients and standard errors; use the clustered SEs (model objects that end with "r")
ates <- matrix(NA, nrow=14, ncol=3)
getSE <- function(mod, i){
  #i <- which(names(mod)==var_name)
  b <- mod[i, 1]
  se <- mod[i,2]
  return(c(b,b-1.96*se,b+1.96*se))
}

ates[1,] <- getSE(mod.pooled.1r, 2)
ates[2,] <- getSE(mod.pooled.1r, 3)
ates[3,] <- getSE(mod.hr.1r, 2)
ates[4,] <- getSE(mod.hr.1r, 3)
ates[5,] <- getSE(mod.climate.1r, 2)
ates[6,] <- getSE(mod.climate.1r, 3)
ates[7,] <- getSE(mod.aid.1r, 2)
ates[8,] <- getSE(mod.aid.1r, 3)
ates[9,] <- getSE(mod.security.1r, 2)
ates[10,] <- getSE(mod.security.1r, 3)
ates[11,] <- getSE(mod.coop.1r, 2)
ates[12,] <- getSE(mod.coop.1r, 3)
ates[13,] <- getSE(mod.econ.1r, 2)
ates[14,] <- getSE(mod.econ.1r, 3)

#Label the data frame: 
names.coefs <- rbind("Partner", "Adversary", "Partner", "Adversary","Partner", "Adversary","Partner", "Adversary","Partner", "Adversary","Partner", "Adversary","Partner", "Adversary")
dvs.ates <- rbind("Pooled", "Pooled", "Human Rights", "Human Rights", "Climate", "Climate", "Aid", "Aid", "Security", "Security", "Institutions", "Institutions", "Economics", "Economics")
df.ates <- data.frame(cbind(names.coefs, ates, dvs.ates))
colnames(df.ates) <- c("Treatment", "Effect", "Low", "High", "Issue")
df.ates$Effect <- as.numeric(as.character(df.ates$Effect))
df.ates$Low <- as.numeric(as.character(df.ates$Low))
df.ates$High <- as.numeric(as.character(df.ates$High))
df.ates$Treatment <- factor(df.ates$Treatment) 

#Order the levels for the y-axis:
df.ates$Issue <- factor(df.ates$Issue , levels = c("Pooled",  "Human Rights", "Climate", "Aid", "Institutions", "Security",  "Economics"))

#####Generate Figure 2: 
dev.new(height=7,width=12)
p.ates <- ggplot(df.ates, aes(x=Effect, y=Issue)) +  
  geom_vline(xintercept = 0, colour="gray70", linewidth=1) + 
  geom_pointrangeh(data=df.ates, mapping=(aes(x=Effect, y=Issue, xmin=Low, xmax=High, linetype=factor(Treatment), shape=factor(Treatment))), 
                   position = position_dodge2v(height = 0.75), size=I(1.1)) + 
  scale_y_discrete(limits = rev(levels(df.ates$Issue))) + xlim(-0.07, 0.07) +
  scale_linetype_discrete(name="") +
  scale_shape_discrete(name="") +
  ylab("") + xlab("Coefficient (95% Confidence Interval)") + ggtitle("") +
  coord_cartesian(clip="off") +
  theme_bw() + theme(axis.text.y=element_text(color="black", size=16), axis.text.x=element_text(color="black", size=16), 
                     axis.title.y=element_text(color="black"),
                     axis.title.x=element_text(size=14), plot.title=element_text(color="black", size=14, hjust=0.5),
                     legend.text=element_text(size=14), 
                     legend.position="bottom", plot.margin = unit(c(.5,.5,.5,1.5), "cm")) 
## Figure 2: 
p.ates 



# Correlates of issue support ---------------------------------------------

# "Supplemental analyses show that the adversary treatment decreases support for every policy program in our survey..."

#Human Rights Support
mod.hr.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                     pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + 
                     polint1 + mi1 + ci1 + isolat1 + rel_attendr + rel_impr, data=dat.hr2)
mod.hr.2suppr <- coeftest(mod.hr.2supp, vcov = vcovCL, cluster=~ResponseId)

#Climate:
mod.climate.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                          pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + 
                          polint1 + mi1 + ci1 + isolat1 +
                          rel_attendr + rel_impr, data=dat.climate2)
mod.climate.2suppr <- coeftest(mod.climate.2supp, vcov = vcovCL, cluster=~ResponseId)


#Aid:
mod.aid.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                      pidreplean + piddemlean + university + inc1 + inc2 + inc3  + regionf + 
                      polint1 + mi1 + ci1 + isolat1 + rel_attendr + rel_impr, data=dat.aid2)
mod.aid.2suppr <- coeftest(mod.aid.2supp, vcov = vcovCL, cluster=~ResponseId)

#Security:
mod.security.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                       pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + 
                         polint1 + mi1 + ci1 + isolat1 + rel_attendr + rel_impr, data=dat.security2)
mod.security.2suppr <- coeftest(mod.security.2supp, vcov = vcovCL, cluster=~ResponseId)

#Cooperation:
mod.coop.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                       pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + 
                       polint1 + mi1 + ci1 + isolat1 + rel_attendr + rel_impr, data=dat.coop2)
mod.coop.2suppr <- coeftest(mod.coop.2supp, vcov = vcovCL, cluster=~ResponseId)

#Economics:
mod.econ.2supp <- lm(dv_support ~ hisalience + treatment + man + nhwhite + gensilent + genboom + genx + genmill +
                       pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf +  
                       polint1 + mi1 + ci1 + isolat1 + rel_attendr + rel_impr, data=dat.econ2)
mod.econ.2suppr <- coeftest(mod.econ.2supp, vcov = vcovCL, cluster=~ResponseId)


#Adversary treatment decreases support across issue areas:
cbind((round(mod.hr.2suppr[4, "Estimate"], digits=2)), round(mod.hr.2suppr[4, "Pr(>|t|)"], digits=3)) #Human rights b=-0.04, p<0.01
cbind((round(mod.climate.2suppr[4, "Estimate"], digits=2)), round(mod.climate.2suppr[4, "Pr(>|t|)"], digits=3)) # Climate b=-0.07, p<0.01
cbind((round(mod.aid.2suppr[4, "Estimate"], digits=2)), round(mod.aid.2suppr[4, "Pr(>|t|)"], digits=3)) #Foreign Aid b=-0.08, p<0.01
cbind((round(mod.security.2suppr[4, "Estimate"], digits=2)), round(mod.security.2suppr[4, "Pr(>|t|)"], digits=3)) #Security b=-0.04, p<0.01
cbind((round(mod.coop.2suppr[4, "Estimate"], digits=2)), round(mod.coop.2suppr[4, "Pr(>|t|)"], digits=3)) #Cooperation b=-0.09, p<0.01
cbind((round(mod.econ.2suppr[4, "Estimate"], digits=2)), round(mod.econ.2suppr[4, "Pr(>|t|)"], digits=3)) #Economic b=-0.06, p<0.01



# Exploratory Analysis for Individual country Treatment effects ----------------------------------

#Separate pooled model with individual country names
mod.pooled.country <- lm(dv_moral ~ countrytreat + issuearea, data=data_long)
mod.pooled.countryr <- coeftest(mod.pooled.country, vcov = vcovCL, cluster=~ResponseId)

# "Only the Japan treatment weakens moral conviction in the pooled model..." 
rbind(cbind("Japan", round(mod.pooled.countryr[6, "Estimate"], digits=2), round(mod.pooled.countryr[6, "Pr(>|t|)"], digits=3)), #b=-0.02, p<0.01
cbind("Canada", round(mod.pooled.countryr[2, "Estimate"], digits=2), round(mod.pooled.countryr[2, "Pr(>|t|)"], digits=3)), #p=0.727
cbind("China" ,round(mod.pooled.countryr[3, "Estimate"], digits=2), round(mod.pooled.countryr[3, "Pr(>|t|)"], digits=3)), # p=0.186
cbind("Great Britain" , round(mod.pooled.countryr[4, "Estimate"], digits=2), round(mod.pooled.countryr[4, "Pr(>|t|)"], digits=3)), # p=0.382
cbind("Iran", round(mod.pooled.countryr[5, "Estimate"], digits=2), round(mod.pooled.countryr[5, "Pr(>|t|)"], digits=3)), # p=0.193
cbind("Russia", round(mod.pooled.countryr[7, "Estimate"], digits=2), round(mod.pooled.countryr[7, "Pr(>|t|)"], digits=3))) # p=0.368


#"Policy-specific models show that each adversary treatment decreases moral conviction about some set of policies..."
mod.hr1.countries <- lm(hr1moral ~ country1, data=data) #defending human rights
mod.hr1.countries <- summary(mod.hr1.countries)

mod.hr2.countries <- lm(hr2moral ~ country2, data=data) #decent work protections
mod.hr2.countries <- summary(mod.hr2.countries)

mod.climate1.countries <- lm(climate1moral ~ country3, data=data) # reduce fossil fuels
mod.climate1.countries <- summary(mod.climate1.countries)

mod.climate2.countries <- lm(climate2moral ~ country4, data=data) #biodiversity
mod.climate2.countries <- summary(mod.climate2.countries)

mod.aid1.countries <- lm(aid1moral ~ country5, data=data) #digital inclusion
mod.aid1.countries <- summary(mod.aid1.countries)

mod.aid2.countries <- lm(aid2moral ~ country6, data=data) #vaccine programs
mod.aid2.countries <- summary(mod.aid2.countries)

mod.security1.countries <- lm(security1moral ~ country7, data=data) #counter-terrorism
mod.security1.countries <- summary(mod.security1.countries)

mod.security2.countries <- lm(security2moral ~ country8, data=data) #nuclear sabotage
mod.security2.countries <- summary(mod.security2.countries)

mod.coop1.countries <- lm(cooperation1moral ~ country9, data=data) #international institutions
mod.coop1.countries <- summary(mod.coop1.countries)

mod.coop2.countries <- lm(cooperation2moral ~ country10, data=data) #ICJ
mod.coop2.countries <- summary(mod.coop2.countries)

mod.economic1.countries <- lm(economic1moral ~ country11, data=data) #lifting tariffs
mod.economic1.countries <- summary(mod.economic1.countries)

mod.economic2.countries <- lm(economic2moral ~ country12, data=data) #FDI limits
mod.economic2.countries <- summary(mod.economic2.countries)


#The Iran treatment decreases moralization about defending human rights, biodiversity initiatives, and cooperating with international institutions
#increases moral convicition about supporting the ICJ, FDI limits
rbind(cbind("defending human rights", round(mod.hr1.countries$coefficients[5,1], digits=2), round(mod.hr1.countries$coefficients[5,4], digits=3)), #b=-0.04, p<0.05
      cbind("decent work", round(mod.hr2.countries$coefficients[5,1], digits=2), round(mod.hr2.countries$coefficients[5,4], digits=3)), #b=-0.02, p=0.254
      cbind("reduce fossil fuels", round(mod.climate1.countries$coefficients[5,1], digits=2), round(mod.climate1.countries$coefficients[5,4], digits=3)), # b=-0.02, p=0.355
      cbind("biodiversity", round(mod.climate2.countries$coefficients[5,1], digits=2), round(mod.climate2.countries$coefficients[5,4], digits=3)), # b=-0.05 p<0.05
      cbind("digital inclusion", round(mod.aid1.countries$coefficients[5,1], digits=2), round(mod.aid1.countries$coefficients[5,4], digits=3)), # b=0.02, p=0.46
      cbind("vaccine programs", round(mod.aid2.countries$coefficients[5,1], digits=2), round(mod.aid2.countries$coefficients[5,4], digits=3)), #b=-0.01, p=0.784
      cbind("counter-terrorism", round(mod.security1.countries$coefficients[5,1], digits=2), round(mod.security1.countries$coefficients[5,4], digits=3)), # b=0, p=0.958
      cbind("nuclear sabotage", round(mod.security2.countries$coefficients[5,1], digits=2), round(mod.security2.countries$coefficients[5,4], digits=3)), #b=0.03, p=0.258
      cbind("institutions", round(mod.coop1.countries$coefficients[5,1], digits=2), round(mod.coop1.countries$coefficients[5,4], digits=3)), # b=-0.08, p<0.01
      cbind("ICJ", round(mod.coop2.countries$coefficients[5,1], digits=2), round(mod.coop2.countries$coefficients[5,4], digits=3)), # b=0.04, p<0.1
      cbind("lift tariffs", round(mod.economic1.countries$coefficients[5,1], digits=2), round(mod.economic1.countries$coefficients[5,4], digits=3)), # b=0.02, p=0.418
      cbind("FDI limits", round(mod.economic2.countries$coefficients[5,1], digits=2), round(mod.economic2.countries$coefficients[5,4], digits=3))) # p=0.04, p<0.1

#Japan, Canada, and Great Britain each decrease conviction about FDI (Canada p<0.05, Japan and Great Britain p<0.1):
mod.economic2.countries

#Japan, Canada, and Great Britain have positive signs on moral conviction about lifting tariffs:
mod.economic1.countries

#Count the nulls and p>0.05 in each model
mods.policy.country <- list(mod.hr1.countries = mod.hr1.countries, mod.hr2.countries= mod.hr2.countries, mod.climate1.countries = mod.climate1.countries, 
                            mod.climate2.countries = mod.climate2.countries,mod.aid1.countries = mod.aid1.countries,mod.aid2.countries = mod.aid2.countries,
                            mod.security1.countries = mod.security1.countries, mod.security2.countries = mod.security2.countries, mod.coop1.countries = mod.coop1.countries, 
                            mod.coop2.countries = mod.coop2.countries, mod.economic1.countries =  mod.economic1.countries, mod.economic2.countries = mod.economic2.countries)

nulls <- sapply(mods.policy.country, null_count, exclude_intercept=TRUE)
sig <- sapply(mods.policy.country, sig_count, exclude_intercept=TRUE)

#The nulls outnumber significant country treatment effects: 
totalnull <- sum(nulls)
totalsig <- sum(sig)
totalnull # 59
totalsig # 13



# Table 2: The Correlates of Foreign Policy Moral Conviction  -------------

#Human Rights
o.hr.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
               pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.hr)
obmod.hr.2r <- coeftest(o.hr.2, vcov = vcovCL, cluster=~ResponseId)
 
#Climate:
o.clim.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
                 pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.climate)
obmod.climate.2r <- coeftest(o.clim.2, vcov = vcovCL, cluster=~ResponseId)


#Aid:
o.aid.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
                pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.aid)
obmod.aid.2r <- coeftest(o.aid.2, vcov = vcovCL, cluster=~ResponseId)


#Security:
o.sec.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
                pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.security)
obmod.security.2r <- coeftest(o.sec.2, vcov = vcovCL, cluster=~ResponseId)

#Cooperation:
o.coop.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
                 pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.coop)
obmod.coop.2r <- coeftest(o.coop.2, vcov = vcovCL, cluster=~ResponseId)

#Economics:
o.econ.2 <- lm(dv_moral ~ hisalience + treatment + mi1 + ci1 + isolat1 + man + nhwhite + gensilent + genboom + genx + genmill +
                     pidreplean + piddemlean + university + inc1 + inc2 + inc3 + regionf + polint1 + rel_attendr + rel_impr, data=dat.econ)
obmod.econ.2r <- coeftest(o.econ.2, vcov = vcovCL, cluster=~ResponseId)

#Generate Table 2 formatted for LaTeX:
stargazer(o.hr.2, o.clim.2, o.aid.2, o.sec.2, o.coop.2, o.econ.2, title="The Correlates of Foreign Policy Moral Conviction",
          omit.stat=c("LL", "ser", "f", "adj.rsq"), style="apsr", digits=2, label="tab:issuevar", 
          se=list(as.numeric(obmod.hr.2r[,2]), as.numeric(obmod.climate.2r[,2]), as.numeric(obmod.aid.2r[,2]), as.numeric(obmod.security.2r[,2]), 
                  as.numeric(obmod.coop.2r[,2]), as.numeric(obmod.econ.2r[,2]) ),
          omit = c("nhwhite","inc1", "inc2", "inc3", "regionfnortheast", "regionfsouth", "regionfwest", "rel_attendr", "rel_impr"),
          covariate.labels = c("Higher Salience", "Partner", "Adversary", "MI", "CI", "Isolationism", "Man", "Gen: Silent", "Gen: Boomer",
                               "Gen: X", "Gen: Milennial", "Republican", "Democrat", "University", "Pol. Interest"), 
          star.cutoffs = c(0.1, 0.05, 0.01), star.char=c("\\dagger", "*", "**"), notes="$^{\\dagger}$p $<$ .1; $^{*}$p $<$ .05; $^{**}$p $<$ .01") #model labels added manually; note adds the correct legend; delete the line above it for final table


#Referenced in text:
#Cooperative internationalism predicts moral conviction about human rights, foreign aid, climate change, and security:
rbind(cbind("human rights", round(obmod.hr.2r["ci1", "Estimate"], digits=2), round(obmod.hr.2r["ci1", "Pr(>|t|)"], digits=3)), #b=0.24, p<0.01
      cbind("aid", round(obmod.aid.2r["ci1", "Estimate"], digits=2), round(obmod.aid.2r["ci1", "Pr(>|t|)"], digits=3)), #b=0.17, p<0.01
      cbind("climate", round(obmod.climate.2r["ci1", "Estimate"], digits=2), round(obmod.climate.2r["ci1", "Pr(>|t|)"], digits=3)), # b=0.3, p<0.01
      cbind("cooperation", round(obmod.coop.2r["ci1", "Estimate"], digits=2), round(obmod.coop.2r["ci1", "Pr(>|t|)"], digits=3)), # b=0.22, p<0.01
      cbind("security", round(obmod.security.2r["ci1", "Estimate"], digits=2), round(obmod.security.2r["ci1", "Pr(>|t|)"], digits=3))) # b=0.08, p<0.05
 
#Militant internationalism predicts stronger moral conviction about security, international cooperation, and economic issues
rbind(cbind("economic", round(obmod.econ.2r["mi1", "Estimate"], digits=2), round(obmod.econ.2r["mi1", "Pr(>|t|)"], digits=3)), # b=0.12, p<0.01
      cbind("cooperation", round(obmod.coop.2r["mi1", "Estimate"], digits=2), round(obmod.coop.2r["mi1", "Pr(>|t|)"], digits=3)), # b=0.08, p<0.01
      cbind("security", round(obmod.security.2r["mi1", "Estimate"], digits=2), round(obmod.security.2r["mi1", "Pr(>|t|)"], digits=3))) # b=0.18, p<0.01

#Isolationism does not consistently predict moral conviction, except human rights (negative) and economics:
rbind(cbind("human rights", round(obmod.hr.2r["isolat1", "Estimate"], digits=2), round(obmod.hr.2r["isolat1", "Pr(>|t|)"], digits=3)), #b=-0.08, p<0.01
      cbind("aid", round(obmod.aid.2r["isolat1", "Estimate"], digits=2), round(obmod.aid.2r["isolat1", "Pr(>|t|)"], digits=3)), #b=0, p=0.85
      cbind("climate", round(obmod.climate.2r["isolat1", "Estimate"], digits=2), round(obmod.climate.2r["isolat1", "Pr(>|t|)"], digits=3)), # b=-0.02, p=0.465
      cbind("cooperation", round(obmod.coop.2r["isolat1", "Estimate"], digits=2), round(obmod.coop.2r["isolat1", "Pr(>|t|)"], digits=3)), # b=-0.03, p=0.225
      cbind("security", round(obmod.security.2r["isolat1", "Estimate"], digits=2), round(obmod.security.2r["isolat1", "Pr(>|t|)"], digits=3)), #b=0.03, p=0.255
      cbind("economic", round(obmod.econ.2r["isolat1", "Estimate"], digits=2), round(obmod.econ.2r["isolat1", "Pr(>|t|)"], digits=3))) # b=0.06, p<0.05

##See MP_study1_2 for t-test results with tercile comparisons!


#Republicans and Democrats moralize security and economics to comparable degrees:
rbind(cbind("security", round(obmod.security.2r["pidreplean", "Estimate"], digits=2), round(obmod.security.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=0.02, p=0.206
      cbind("security", round(obmod.security.2r["piddemlean", "Estimate"], digits=2), round(obmod.security.2r["piddemlean", "Pr(>|t|)"], digits=3)), #b=0.03, p=0.093
      cbind("economic", round(obmod.econ.2r["pidreplean", "Estimate"], digits=2), round(obmod.econ.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=0, p=0.947
      cbind("economic", round(obmod.econ.2r["piddemlean", "Estimate"], digits=2), round(obmod.econ.2r["piddemlean", "Pr(>|t|)"], digits=3))) # b=0, p=0.794

#Partisan gaps for human rights, foreign aid, climate change, and international cooperation:
rbind(cbind("human rights", round(obmod.hr.2r["pidreplean", "Estimate"], digits=2), round(obmod.hr.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=-0.01, p=0.513
      cbind("human rights", round(obmod.hr.2r["piddemlean", "Estimate"], digits=2), round(obmod.hr.2r["piddemlean", "Pr(>|t|)"], digits=3)), #b=0.04, p<0.05
      cbind("aid", round(obmod.aid.2r["pidreplean", "Estimate"], digits=2), round(obmod.aid.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=-0.04, p<0.05
      cbind("aid", round(obmod.aid.2r["piddemlean", "Estimate"], digits=2), round(obmod.aid.2r["piddemlean", "Pr(>|t|)"], digits=3)), #b=0.03, p=0.05
      cbind("climate", round(obmod.climate.2r["pidreplean", "Estimate"], digits=2), round(obmod.climate.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=-0.04, p<0.05
      cbind("climate", round(obmod.climate.2r["piddemlean", "Estimate"], digits=2), round(obmod.climate.2r["piddemlean", "Pr(>|t|)"], digits=3)), #b=0.02, p=0.195
      cbind("cooperation", round(obmod.coop.2r["pidreplean", "Estimate"], digits=2), round(obmod.coop.2r["pidreplean", "Pr(>|t|)"], digits=3)), #b=0.01, p=0.748
      cbind("cooperation", round(obmod.coop.2r["piddemlean", "Estimate"], digits=2), round(obmod.coop.2r["piddemlean", "Pr(>|t|)"], digits=3))) # b=0.04, p<0.01



